#!/usr/bin/perl -w  # useful for syntax highlighting!
package clreqd_modules;

use strict;
use cldb;
use Data::Dumper;
use Config;
use clutils qw(to_bool);

sub remove_clevent {
my %ARGS=@_;
my $rc;

	my $NAME=$ARGS{NAME};

	my $CLDB=new cldb("$::ENV{TRUECL_CFG}/config.db");
	if(!defined($CLDB)) {
		return "ERROR Unable to config to 'config' database.";
	}
	my $res=$CLDB->get_rows("SELECT * FROM cluster_events WHERE name = '$NAME';");
	if(!defined($res->[0]->{name})) {
		return "NO_EVENT";
	}

	#################################################################
	# Now we can remove the record					#
	#################################################################

	$res=$CLDB->do("DELETE FROM cluster_events WHERE name = '$NAME';");
	if(!$res) {
		my ($err_rc,$err_str)=cldb::error();
		return "ERROR Failed to write to config database: $err_str [RC=$err_rc]";
	}
	return "OK";
}

1;

